// 自定义时间设置
export const selfTimeSetting = {
  shortcuts: [
    {
      text: '最近一天',
      onClick (picker) {
        const end = new Date()
        const start = new Date()
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 1)
        const startTime = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, 0)
        const endTime = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 23, 59, 59)
        picker.$emit('pick', [startTime, endTime])
      }
    },
    {
      text: '最近一周',
      onClick (picker) {
        const end = new Date()
        const start = new Date()
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 6)
        const startTime = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, 0)
        const endTime = new Date(end.getFullYear(), end.getMonth(), end.getDate(), 23, 59, 59)
        picker.$emit('pick', [startTime, endTime])
      }
    }, {
      text: '最近一个月',
      onClick (picker) {
        const end = new Date()
        const start = new Date()
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 29)
        const startTime = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, 0)
        const endTime = new Date(end.getFullYear(), end.getMonth(), end.getDate(), 23, 59, 59)
        picker.$emit('pick', [startTime, endTime])
      }
    }, {
      text: '最近一年',
      onClick (picker) {
        const end = new Date()
        const start = new Date()
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 365)
        const startTime = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0, 0, 0)
        const endTime = new Date(end.getFullYear(), end.getMonth(), end.getDate(), 23, 59, 59)
        picker.$emit('pick', [startTime, endTime])
      }
    }]
}

export const selfTimeSetting2 = {
  disabledDate (time) {
    return time.getTime() > Date.now();
  },
  shortcuts: [
    {
      text: '昨天',
      onClick (picker) {
        const date = new Date();
        date.setTime(date.getTime() - 3600 * 1000 * 24);
        picker.$emit('pick', date);
      }
    },
    {
      text: '今天',
      onClick (picker) {
        const date = new Date();
        date.setTime(date.getTime());
        picker.$emit('pick', date);
      }
    }
    // {
    //   text: '最近一周',
    //   onClick (picker) {
    //     const date = new Date();
    //     date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
    //     picker.$emit('pick', date);
    //   }
    // },
    // {
    //   text: '最近一月',
    //   onClick (picker) {
    //     const date = new Date();
    //     date.setTime(date.getTime() - 3600 * 1000 * 24 * 30);
    //     picker.$emit('pick', date);
    //   }
    // },
    // {
    //   text: '最近一年',
    //   onClick (picker) {
    //     const date = new Date();
    //     date.setTime(date.getTime() - 3600 * 1000 * 24 * 365);
    //     picker.$emit('pick', date);
    //   }
    // }
  ]
}
